package filters;

import java.io.File;

import javax.swing.filechooser.FileFilter;

public class TIOAFilter extends FileFilter {

    @Override
    public boolean accept(File arg0) {
        if (arg0.isDirectory()) {
            return true;
        }
        String str = TIOAFilter.getExtension(arg0);
        if (str != null) {
            if (str.equals("tioa")) {
                return true;
            } else {
                return false;
            }
        }
        return false;


    }

    public static String getExtension(File arg0) {
        String ext = null;
        String s = arg0.getName();
        int i = s.lastIndexOf('.');

        if (i > 0 && i < s.length() - 1) {
            ext = s.substring(i + 1).toLowerCase();
        }
        return ext;

    }

    @Override
    public String getDescription() {
        return "*.tioa";
    }
}
